package com.example.a79273.shandianban.model;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by 79273 on 2016/9/1.
 */
public class YouLiao02Bean {

    /**
     * error_code : 0
     * error_msg : 获取有料信息成功！
     * total : 0
     * data : {"detail":{"id":"234001674942","play":196,"comment":0,"title":"【设计师专访】对话「衫点扮」创始人Andy","contentdate":"2016-08-03","content":"","sharetitle":"【这些毛衣很不错，快来帮我看看】","sharepic":"/Upload/Document/234001674942/367be27ce0.jpg","shareintro":"色彩马卡龙，衫点扮\u2014汇集全球时尚好毛衣。","sharelink":"http://www.sdb330.com/Document/234001674942"}}
     */

    private int error_code;
    private String error_msg;
    private int total;
    /**
     * detail : {"id":"234001674942","play":196,"comment":0,"title":"【设计师专访】对话「衫点扮」创始人Andy","contentdate":"2016-08-03","content":"","sharetitle":"【这些毛衣很不错，快来帮我看看】","sharepic":"/Upload/Document/234001674942/367be27ce0.jpg","shareintro":"色彩马卡龙，衫点扮\u2014汇集全球时尚好毛衣。","sharelink":"http://www.sdb330.com/Document/234001674942"}
     */

    private DataBean data;

    public static YouLiao02Bean objectFromData(String str) {

        return new Gson().fromJson(str, YouLiao02Bean.class);
    }

    public static YouLiao02Bean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), YouLiao02Bean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<YouLiao02Bean> arrayYouLiao02BeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<YouLiao02Bean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<YouLiao02Bean> arrayYouLiao02BeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<YouLiao02Bean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getError_code() {
        return error_code;
    }

    public void setError_code(int error_code) {
        this.error_code = error_code;
    }

    public String getError_msg() {
        return error_msg;
    }

    public void setError_msg(String error_msg) {
        this.error_msg = error_msg;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * id : 234001674942
         * play : 196
         * comment : 0
         * title : 【设计师专访】对话「衫点扮」创始人Andy
         * contentdate : 2016-08-03
         * content :
         * sharetitle : 【这些毛衣很不错，快来帮我看看】
         * sharepic : /Upload/Document/234001674942/367be27ce0.jpg
         * shareintro : 色彩马卡龙，衫点扮—汇集全球时尚好毛衣。
         * sharelink : http://www.sdb330.com/Document/234001674942
         */

        private DetailBean detail;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public DetailBean getDetail() {
            return detail;
        }

        public void setDetail(DetailBean detail) {
            this.detail = detail;
        }

        public static class DetailBean {
            private String id;
            private int play;
            private int comment;
            private String title;
            private String contentdate;
            private String content;
            private String sharetitle;
            private String sharepic;
            private String shareintro;
            private String sharelink;

            public static DetailBean objectFromData(String str) {

                return new Gson().fromJson(str, DetailBean.class);
            }

            public static DetailBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), DetailBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<DetailBean> arrayDetailBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<DetailBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<DetailBean> arrayDetailBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<DetailBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public int getPlay() {
                return play;
            }

            public void setPlay(int play) {
                this.play = play;
            }

            public int getComment() {
                return comment;
            }

            public void setComment(int comment) {
                this.comment = comment;
            }

            public String getTitle() {
                return title;
            }

            public void setTitle(String title) {
                this.title = title;
            }

            public String getContentdate() {
                return contentdate;
            }

            public void setContentdate(String contentdate) {
                this.contentdate = contentdate;
            }

            public String getContent() {
                return content;
            }

            public void setContent(String content) {
                this.content = content;
            }

            public String getSharetitle() {
                return sharetitle;
            }

            public void setSharetitle(String sharetitle) {
                this.sharetitle = sharetitle;
            }

            public String getSharepic() {
                return sharepic;
            }

            public void setSharepic(String sharepic) {
                this.sharepic = sharepic;
            }

            public String getShareintro() {
                return shareintro;
            }

            public void setShareintro(String shareintro) {
                this.shareintro = shareintro;
            }

            public String getSharelink() {
                return sharelink;
            }

            public void setSharelink(String sharelink) {
                this.sharelink = sharelink;
            }
        }
    }
}
